
package com.enuo.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

/**
 * @ClassName: Admin 
 * @Description: TODO(Entity) 
 * @author Charles 
 * @date 2017年11月16日 上午10:50:12 
 * @version 1.0
 */
@Entity
@Table(name = "admin", uniqueConstraints = @UniqueConstraint(columnNames = "username"))
public class Admin extends BaseEntity
{
    /** 
     * @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么) 
     */ 
    private static final long serialVersionUID = -2662070558764197675L;

    private String username;

    private String password;

    private String email;

    private String name;

    private String department;

    private Boolean enabled;

    private Boolean locked;

    private Integer loginFailureCount;

    private Date lockedDate;

    private Date loginDate;

    private String loginIp;

    @NotEmpty(groups = Save.class)
    @Pattern(regexp = "^[0-9a-z_A-Z\\u4e00-\\u9fa5]+$")
    @Length(min = 2, max = 20)
    @Column(nullable = false, updatable = false, unique = true, length = 100)
    public String getUsername()
    {
        return username;
    }

    public void setUsername(String username)
    {
        this.username = username;
    }

    @NotEmpty(groups = Save.class)
    @Pattern(regexp = "^[^\\s&\"<>]+$")
    @Length(min = 6, max = 20)
    @Column(nullable = false)
    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    @Email
    @Length(max = 200)
    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    @Length(max = 200)
    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    @Length(max = 200)
    public String getDepartment()
    {
        return department;
    }

    public void setDepartment(String department)
    {
        this.department = department;
    }

    @NotNull
    @Column(nullable = false)
    public Boolean getEnabled()
    {
        return enabled;
    }

    public void setEnabled(Boolean enabled)
    {
        this.enabled = enabled;
    }

    @Column(nullable = false)
    public Boolean getLocked()
    {
        return locked;
    }

    public void setLocked(Boolean locked)
    {
        this.locked = locked;
    }

    @Column(nullable = false)
    public Integer getLoginFailureCount()
    {
        return loginFailureCount;
    }

    public void setLoginFailureCount(Integer loginFailureCount)
    {
        this.loginFailureCount = loginFailureCount;
    }

    public Date getLockedDate()
    {
        return lockedDate;
    }

    public void setLockedDate(Date lockedDate)
    {
        this.lockedDate = lockedDate;
    }

    public Date getLoginDate()
    {
        return loginDate;
    }

    public void setLoginDate(Date loginDate)
    {
        this.loginDate = loginDate;
    }

    public String getLoginIp()
    {
        return loginIp;
    }

    public void setLoginIp(String loginIp)
    {
        this.loginIp = loginIp;
    }
}